const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    drug_list: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "处方",
      field: "drug_list"
    },
    time: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: '',
      primaryKey: false,
      autoIncrement: false,
      comment: "施药时间",
      field: "time"
    },
    code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "施药养殖单位",
      field: "code"
    },
    disease: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "发病情况",
      field: "disease"
    },
    treat: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "治疗情况",
      field: "treat"
    },
    person: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "处方人",
      field: "person"
    },
    num: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "用量",
      field: "num"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "drugs_use_log",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const DrugsUseLogModel = sequelize.define("drugs_use_log_model", attributes, options);
  return DrugsUseLogModel;
};